09. IDs and Classes
IDs and Classes
IDs and Classes
Example HTML
<div id="top">
<p class="first_paragraph">First paragraph of the section</p>
<p class="second_paragraph">Second paragraph of the section</p>
</div>
<div id="bottom">
<p class="first_paragraph">First paragraph of the section</p>
<p class="second_paragraph">Second paragraph of the section</p>
</div>
IDs vs Classes
SOLUTION:
- IDs are for marking a specific piece of content
- Classes help group multiple pieces of content together in order to add the same styling.
- You should only use an ID name one time per html page